package rules.tree;

import java.util.ArrayList;
import org.jdom.Element;

public class PropertyAtom extends Atom {

	private Var v1 = null;
	private Var v2 = null;
	private String attribute = null;
	private String constant = null;
	private Function f1 = null;
	private Function f2 = null;

	public PropertyAtom(String attribute, Var v1, Var v2) {
                super(new Element("propertyAtom"));
		this.attribute = attribute;
                this.v1 = v1;
		this.v2 = v2;
                el.setAttribute("property", attribute);
                Element c = new Element("args");             
                c.addContent(v1.getElement());
                c.addContent(v2.getElement());
                el.addContent(c);
	}
	
	public PropertyAtom(String attribute, Var v1, String constant) {
                super(new Element("propertyAtom"));
		this.attribute = attribute;
		this.v1 = v1;
		this.constant = constant;
                el.setAttribute("property", attribute);
                Element arg = new Element("args");
                arg.addContent(v1.getElement());
                Element e2 = new Element("constant");
                e2.setText(constant);
                arg.addContent(e2);
                el.addContent(arg);

	}

	public PropertyAtom(String attribute, Var v1, Function f2) {
		super(new Element("propertyAtom"));
                this.attribute = attribute;
		this.v1 = v1;
		this.f2 = f2;
                el.setAttribute("property", attribute);
                Element arg = new Element("args");
                arg.addContent(v1.getElement());
                arg.addContent(f2.getElement());
                el.addContent(arg);
	}

	public PropertyAtom(String attribute, Function f1, String constant) {
		super(new Element("propertyAtom"));
                this.attribute = attribute;
		this.f1 = f1;
		this.constant = constant;
                el.setAttribute("property", attribute);
                Element arg = new Element("args");
                arg.addContent(f1.getElement());
                Element e2 = new Element("constant");
                e2.setText(constant);
                arg.addContent(e2);
                el.addContent(arg);
	}

	public PropertyAtom(String attribute, Function f1, Function f2) {
		super(new Element("propertyAtom"));
                this.attribute = attribute;
		this.f1 = f1;
		this.f2 = f2;
                 el.setAttribute("property", attribute);
                Element arg = new Element("args");
                arg.addContent(f1.getElement());
                arg.addContent(f2.getElement());
                el.addContent(arg);
	}

        public PropertyAtom(String attribute, Function f1, Var v2){
           super(new Element("propertyAtom"));
                this.attribute = attribute;
		this.v2 = v2;
		this.f1 = f1;
                el.setAttribute("property", attribute);
                Element arg = new Element("args");
                arg.addContent(f1.getElement());
                arg.addContent(v2.getElement());
                el.addContent(arg);
        }

	public String getAttribute(){
		return attribute;
	}
	
	public String getConstant(){
		return constant;
	}
	
	public Var[] getVar(){
		Var[] var = new Var[2];
		var[0] = v1;
		var[1] = v2;
		return var;
	}
	
	public Function[] getFunction(){
		Function[] func = new Function[2];
		func[0] = f1;
		func[1] = f2;
		return func;
	}
}
